load("@rules_cc//cc:defs.bzl", "cc_test")

cc_test(
    name = "unittest",
    srcs = [
        "unit/internals/general.cpp",
        "unit/internals/optional.cpp",
        "unit/internals/result.cpp",
        "unit/internals/string_utils.cpp",
        "unit/lib/formatting.cpp",
        "unit/lib/nullable.cpp",
        "unit/main.cpp",
        "unit/tracing/common.hpp",
        "unit/tracing/from_current.cpp",
        "unit/tracing/object_trace.cpp",
        "unit/tracing/raw_trace.cpp",
        "unit/tracing/stacktrace.cpp",
        "unit/tracing/traced_exception.cpp",
    ],
    copts = select(
        {
            "@rules_cc//cc/compiler:msvc-cl": [
                "/Z7",
                "/FS",
                "/W4",
                "/permissive-",
            ],
            "//conditions:default": [
                "-g",
                "-O0",
                "-gdwarf-4",
            ],
        },
    ),
    local_defines = ["CPPTRACE_NO_TEST_SNIPPETS"],
    linkstatic = 1,
    deps = [
        "@cpptrace//:cpptrace",
        "@googletest//:gtest",
        "@googletest//:gtest_main",
    ],
)
